package com.darchrow.demo.threadpool;

import com.alibaba.fastjson.JSONObject;
import com.darchrow.demo.threadpool.bean.DemoTaskBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @author mdl
 * @date 2019/11/20
 */
@Slf4j
@Component
public class DemoTask implements ITaskConsumer<DemoTaskBean>{


    @Override
    public DemoTaskBean buildTaskInfo(JSONObject json) {
        return JSONObject.parseObject(json.toString(), DemoTaskBean.class);
    }

    @Override
    public void executeTask(DemoTaskBean taskInfo) {
        // 做事
        log.info("我demo在做事~, 数据: " + JSONObject.toJSONString(taskInfo));
    }
}
